/**
 @Name：CPUIAdmin
 @Author：cplvfx(橙)
 @Site：http://www.gerenwaibao.com/
 **/

layui.extend({
    setter: 'config' //配置模块 
}).define(['setter', 'jquery'], function (exports) {

    var $ = layui.jquery
        , setter = layui.setter
        //对外接口
        , commons = function () { }
        , $body = $('body');

    //5：哭脸，6：笑脸
    commons.msg = function (res, icon = 5) {
        layer.msg(res, { offset: '30%', icon: 5, time: 1500 });
    };

    //按钮禁用和释放
    commons.Disable_button_false = function (status, id) {
        if (status) {
            $(id).attr("disabled", "disabled");
            $(id).addClass("layui-btn-disabled");
        }
        else if (!status) {
            $(id).removeAttr("disabled");
            $(id).removeClass("layui-btn-disabled");
        }
    };

    //将模块根路径设置为 modules 目录
    layui.config({
        base: setter.base + 'modules/'
    });

    //更换图形验证码 
    $body.on('click', '#LAY-user-get-vercode', function () {
        var othis = $(this);
        this.src = 'https://www.oschina.net/action/user/captcha?t=' + new Date().getTime()
    });
 
    //对外输出
    exports('commons', commons);
});
 
 